package cn.wolfcode.contoller;

import cn.wolfcode.domain.OnMsgEntity;
import cn.wolfcode.domain.OutMsgEntity;
import cn.wolfcode.service.IWeCharService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class WeChatController {

    @Autowired
    private IWeCharService weCharService;

    @GetMapping("/weChar")
    public String weChar(String signature,String timestamp,String nonce,String echostr){
        return echostr;
    }


    @PostMapping("/weChar")
    public OutMsgEntity handelMassage(@RequestBody OnMsgEntity onMsgEntity){
        OutMsgEntity outMsgEntity = weCharService.handelMsg(onMsgEntity);
        return outMsgEntity;
    }
}
